import 'package:flutter/material.dart';
import 'package:flutter_design/com/zerogis/flutterdesign/http/MemberService.dart';
import 'package:flutter_design/com/zerogis/flutterdesign/http/TestService.dart';
import 'package:zpub_plugin/zpub_plugin.dart';
import 'package:zpub_bas/zpub_bas.dart';

// INSERT INTO plugin(sys, cata, name, pname, titlee, titlec, closeable, uitype, runn, dir, classurl, icon, service, initpara, height, width, modal, autorun, autoobj, prereq, container, button, align) VALUES('21', 'TestPlugin类别', 'TestPlugin英文名称', NULL, '', '插件标题名称', 1, 4, 1, 'package:zmoa/com/zerogis/zmoa/scene', 'TestPlugin', '', '', '{"plugs":[{"name":"BillAttSeePlugin"}]}', 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0);
void main()
{
  runApp(new TestPlugin());
}

/*
 * 模板页 <br/>
 * 需要传入的键：<br/>
 * 传入的值类型： <br/>
 * 传入的值含义：<br/>
 * 是否必传 ：
 */
class TestPlugin extends PluginStatefulBase
{
  TestPlugin({Key key, plugin}) : super(key: key, plugin: plugin);

  State<StatefulWidget> createState()
  {
    return new TestPluginState();
  }

  static String toStrings()
  {
    return "TestPlugin";
  }
}

/*
 * 页面功能 <br/>
 */
class TestPluginState extends PluginBaseState<TestPlugin>
{
  TestPluginState()
  {
  }

  void initState()
  {
    super.initState();
  }

  Widget build(BuildContext context)
  {
    Widget widget = buildBody(
        context,
        new Column(
          children: <Widget>[
            new IconButton(
              icon: new Icon(Icons.delete),
              onPressed: ()
              {
                TestService.queryShop(this);
              },
            ),
          ],
        ));

    return widget;
  }

  void onClick(Widget widget)
  {

  }

  @override
  void onNetWorkSucceed(String method, Object values)
  {
    if(method =='queryShop')
    {

    }
  }
}


/*
 * 类描述：**模块提供的Service其他模块调用本模块对外提供的相关方法
 * 作者：郑朝军 on 2019/6/6
 * 邮箱：1250393285@qq.com
 * 公司：武汉智博创享科技有限公司
 * 修改人：郑朝军 on 2019/6/6
 * 修改备注：
 */
class TestPluginService extends InterfaceBaseImpl
{
  @override
  Future<T> runPlugin<T extends Object>(State<StatefulWidget> state,
      {dynamic initPara})
  {
    return StateManager.getInstance().startWidegtState(new TestPlugin(), state);
  }

  @override
  Widget runWidget({dynamic initPara})
  {
    return new TestPlugin();
  }
}

